/**
 *
 */
package com.angel.test;

import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;

import com.angel.architecture.services.interfaces.GenericService;
import com.angel.architecture.spring.ApplicationContextSpring;

/**
 * @author William
 *
 */
public abstract class GenericSpringTestCase extends AbstractTransactionalDataSourceSpringContextTests {

	protected abstract String[] getOtherContextsApplicationFiles();

	@Override
	protected String[] getConfigLocations(){
		String[] othersContexts = this.getOtherContextsApplicationFiles();
		if(othersContexts == null){
			othersContexts = new String[]{};
		}
		return ApplicationContextSpring.buildApplicationContextFilesWith(othersContexts);
	}

	protected Object getBean(String beanName){
		return super.getApplicationContext().getBean(beanName);
	}

	protected GenericService getGenericService(String beanName){
		return (GenericService) super.getApplicationContext().getBean(beanName);
	}
}
